package com.drug.mingkang.service.impl;

import com.drug.mingkang.model.HqImm;
import com.drug.mingkang.mapper.HqImmMapper;
import com.drug.mingkang.service.HqImmService;
import com.drug.mingkang.utils.Snowflake;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (HqImm)表服务实现类
 *
 * @author wutao
 * @since 2020-08-11 12:00:13
 */
@Service("hqImmService")
public class HqImmServiceImpl implements HqImmService {
    @Resource
    private HqImmMapper hqImmMapper;
    
    private  Snowflake snowflake = new Snowflake(1,1,1);

    /**
     * 通过ID查询单条数据
     *
     * @param immId 主键
     * @return 实例对象
     */
    @Override
    public HqImm queryById(String immId) {
        return this.hqImmMapper.queryById(immId);
    }

    /**
     * 查询多条数据
     *
     * @return 对象列表
     */
    @Override
    public List<HqImm> queryAllByLimit(HqImm hqImm) {
//        long l = snowflake.nextId();
        return this.hqImmMapper.queryAllByLimit(hqImm);
    }

    /**
     * 统计
     *
     * @return
     */
    @Override
    public int count() {
        return hqImmMapper.count();
    }

    /**
     * 新增数据
     *
     * @param hqImm 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(HqImm hqImm) {
        return hqImmMapper.insert(hqImm);
    }

    /**
     * 修改数据
     *
     * @param hqImm 实例对象
     * @return 实例对象
     */
    @Override
    public int update(HqImm hqImm) {
        return this.hqImmMapper.update(hqImm);
    }

    /**
     * 通过主键删除数据
     *
     * @param immId 主键
     * @return 是否成功
     */
    @Override
    public int deleteById(String immId) {
        return this.hqImmMapper.deleteById(immId);
    }

    /**
     * 查询全部
     * @return
     */
    @Override
    public List<HqImm> queryAll(HqImm hqImm) {
        return hqImmMapper.queryAll(hqImm);
    }

    @Override
    public List<HqImm> queryImmName() {
        return hqImmMapper.queryImmName();
    }
}